home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / +look_here_1st!+ / reader_requests / alienbreed3d2 / cheesesauce / plr2control.s < prev    next >
Text File  |  1997-11-28  |  9KB  |  667 lines

  1.  
  2. PLR2_mouse_control
  3.  jsr ReadMouse
  4.  
  5.  move.l #SineTable,a0
  6.  move.w PLR2s_angspd,d1
  7.  move.w angpos,d0
  8.  and.w #8190,d0
  9.  move.w d0,PLR2s_angpos
  10.  move.w (a0,d0.w),PLR2s_sinval
  11.  adda.w #2048,a0
  12.  move.w (a0,d0.w),PLR2s_cosval
  13.  
  14.  move.l PLR2s_xspdval,d6
  15.  move.l PLR2s_zspdval,d7
  16.  
  17.  neg.l d6
  18.  ble.s .nobug1
  19.  asr.l #1,d6
  20.  add.l #1,d6
  21.  bra.s .bug1
  22. .nobug1
  23.  asr.l #1,d6
  24. .bug1:
  25.  
  26.  neg.l d7
  27.  ble.s .nobug2
  28.  asr.l #1,d7
  29.  add.l #1,d7
  30.  bra.s .bug2
  31. .nobug2
  32.  asr.l #1,d7
  33. .bug2: 
  34.  
  35.  move.w ymouse,d3
  36.  sub.w oldymouse,d3
  37.  add.w d3,oldymouse
  38. ; asr.w #1,d3
  39. ; cmp.w #50,d3
  40. ; ble.s .nofastfor
  41. ; move.w #50,d3
  42. ;.nofastfor:
  43. ; cmp.w #-50,d3
  44. ; bge.s .nofastback
  45. ; move.w #-50,d3
  46. ;.nofastback:
  47.  
  48.  move.w STOPOFFSET,d0
  49.  move.w d3,d2
  50.  asl.w #7,d2
  51.  
  52.  add.w d2,PLR2_AIMSPD
  53.  add.w d3,d0
  54.  cmp.w #-80,d0
  55.  bgt.s .nolookup
  56.  move.w #-512*20,PLR2_AIMSPD
  57.  move.w #-80,d0
  58. .nolookup:
  59.  cmp.w #80,d0
  60.  blt.s .nolookdown
  61.  move.w #512*20,PLR2_AIMSPD
  62.  move.w #80,d0
  63. .nolookdown
  64.  
  65.  move.w d0,STOPOFFSET
  66.  neg.w d0
  67.  add.w TOTHEMIDDLE,d0
  68.  move.w d0,SMIDDLEY
  69.  asr.w #1,d0
  70.  muls #104*4,d0
  71.  move.l d0,SBIGMIDDLEY
  72.  
  73.  move.l #KeyMap,a5
  74.  moveq #0,d7
  75.  move.b forward_key,d7
  76.  
  77.  btst #6,$bfe001
  78.  seq.s (a5,d7.w)
  79.  
  80.  bra PLR2_keyboard_control
  81.  
  82.  move.w #-20,d2
  83.  
  84.  tst.b PLR2_Ducked
  85.  beq.s .nohalve
  86.  asr.w #1,d2
  87. .nohalve
  88.  
  89.  btst #6,$bfe001
  90.  beq.s .moving
  91.  moveq #0,d2
  92. .moving:
  93.  
  94.  move.w d2,d3
  95.  asl.w #4,d2
  96.  move.w d2,d1
  97.  
  98.  move.w d1,ADDTOBOBBLE
  99.  
  100.  move.w PLR2s_sinval,d1
  101.  move.w PLR2s_cosval,d2
  102.  
  103.  move.w d2,d4
  104.  move.w d1,d5
  105.  muls lrs,d4
  106.  muls lrs,d5
  107.  
  108.  muls d3,d2
  109.  muls d3,d1
  110.  sub.l d4,d1
  111.  add.l d5,d2
  112.  
  113.  sub.l d1,d6
  114.  sub.l d2,d7
  115.  add.l d6,PLR2s_xspdval
  116.  add.l d7,PLR2s_zspdval
  117.  move.l PLR2s_xspdval,d6
  118.  move.l PLR2s_zspdval,d7
  119.  add.l d6,PLR2s_xoff
  120.  add.l d7,PLR2s_zoff
  121.  
  122.  tst.b PLR2_fire
  123.  beq.s .firenotpressed
  124. ; fire was pressed last time.
  125.  btst #6,$bfe001
  126.  bne.s .firenownotpressed
  127. ; fire is still pressed this time.
  128.  st PLR2_fire
  129.  bra .donePLR2
  130.  
  131. .firenownotpressed:
  132. ; fire has been released.
  133.  clr.b PLR2_fire
  134.  bra .donePLR2
  135.  
  136. .firenotpressed
  137.  
  138. ; fire was not pressed last frame...
  139.  
  140.  btst #6,$bfe001
  141. ; if it has still not been pressed, go back above
  142.  bne.s .firenownotpressed
  143. ; fire was not pressed last time, and was this time, so has
  144. ; been clicked.
  145.  st PLR2_clicked
  146.  st PLR2_fire
  147.  
  148. .donePLR2:
  149.  
  150.  bsr PLR2_fall
  151.  
  152.  rts
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180. PLR2_alwayskeys
  181.  move.l #KeyMap,a5
  182.  moveq #0,d7
  183.  move.b operate_key,d7
  184.  move.b (a5,d7.w),d1
  185.  beq.s .nottapped
  186.  tst.b OldSpace
  187.  bne.s .nottapped
  188.  st PLR2_SPCTAP
  189. .nottapped:
  190.  move.b d1,OldSpace
  191.  
  192.  move.b duck_key,d7
  193.  tst.b (a5,d7.w)
  194.  beq.s .notduck
  195.  clr.b (a5,d7.w)
  196.  move.l #playerheight,PLR2s_targheight
  197.  not.b PLR2_Ducked
  198.  beq.s .notduck
  199.  move.l #playercrouched,PLR2s_targheight
  200. .notduck:
  201.  
  202.  move.l PLR2_Roompt,a4
  203.  move.l ToZoneFloor(a4),d0
  204.  sub.l ToZoneRoof(a4),d0
  205.  tst.b PLR2_StoodInTop
  206.  beq.s .usebottom
  207.  move.l ToUpperFloor(a4),d0
  208.  sub.l ToUpperRoof(a4),d0
  209. .usebottom:
  210.  
  211.  cmp.l #playerheight+3*1024,d0
  212.  bgt.s .oktostand
  213.  st PLR2_Ducked
  214.  move.l #playercrouched,PLR2s_targheight
  215. .oktostand:
  216.  
  217.  move.l PLR2s_height,d0
  218.  move.l PLR2s_targheight,d1
  219.  cmp.l d1,d0
  220.  beq.s .noupordown
  221.  bgt.s .crouch
  222.  add.l #1024,d0
  223.  bra .noupordown
  224. .crouch:
  225.  sub.l #1024,d0
  226. .noupordown:
  227.  move.l d0,PLR2s_height
  228.  
  229.  tst.b $27(a5)
  230.  beq.s .notselkey
  231.  st PLR2KEYS
  232.  clr.b PLR2PATH
  233.  clr.b PLR2MOUSE
  234.  clr.b PLR2JOY
  235. .notselkey:
  236.  
  237.  tst.b $26(a5)
  238.  beq.s .notseljoy
  239.  clr.b PLR2KEYS
  240.  clr.b PLR2PATH
  241.  clr.b PLR2MOUSE
  242.  st PLR2JOY
  243. .notseljoy:
  244.  
  245.  tst.b $37(a5)
  246.  beq.s .notselmouse
  247.  clr.b PLR2KEYS
  248.  clr.b PLR2PATH
  249.  st PLR2MOUSE
  250.  clr.b PLR2JOY
  251. .notselmouse:
  252.  
  253.  lea 1(a5),a4
  254.  move.l #PLAYERTWOGUNS,a2
  255.  move.l PLR2_Obj,a3
  256.  move.w #9,d1
  257.  move.w #0,d2
  258. pickweap2
  259.  move.w (a2)+,d0
  260.  and.b (a4)+,d0
  261.  beq.s notgotweap2
  262.  move.b d2,PLR2_GunSelected
  263.  move.w #0,ObjTimer+64(a3)
  264.  
  265.  move.l #TEMPSCROLL,SCROLLPOINTER
  266.  move.w #0,SCROLLXPOS
  267.  move.l #TEMPSCROLL+160,ENDSCROLL
  268.  move.w #40,SCROLLTIMER
  269.  
  270. ; d2=number of gun.
  271.  
  272.  move.l LINKFILE,a4
  273.  add.l #GunObjects,a4
  274.  move.w (a4,d2.w*2),d2
  275.  
  276.  move.l LINKFILE,a4
  277.  add.l #ObjectNames,a4
  278.  muls #20,d2
  279.  add.l d2,a4
  280.  move.l #TEMPSCROLL,a2
  281.  move.w #19,d2
  282.  
  283. .copyname:
  284.  move.b (a4)+,d3
  285.  bne.s .oklet
  286.  move.b #32,d3
  287. .oklet:
  288.  move.b d3,(a2)+
  289.  
  290.  dbra d2,.copyname
  291.  bra.s gogogogog
  292.  
  293. notgotweap2
  294.  addq #1,d2
  295.  dbra d1,pickweap2
  296.  
  297. gogogogog:
  298.  
  299.  ifeq CHEESEY
  300.  
  301.  tst.b $43(a5)
  302.  beq.s .notswapscr
  303.  tst.b lastscr
  304.  bne.s .notswapscr2
  305.  st lastscr
  306.  
  307.  not.b FULLSCRTEMP
  308.  
  309.  bra.s .notswapscr2
  310.  
  311. .notswapscr:
  312.  clr.b lastscr
  313. .notswapscr2:
  314.  
  315.  endc
  316.  
  317.  rts
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362. TURNSPD: dc.w 0
  363.  
  364. PLR2_keyboard_control:
  365.  
  366.  move.l #SineTable,a0
  367.  
  368.  jsr PLR2_alwayskeys
  369.  move.l #KeyMap,a5
  370.  
  371.  move.w STOPOFFSET,d0
  372.  moveq #0,d7
  373.  move.b look_up_key,d7
  374.  tst.b (a5,d7.w)
  375.  beq.s .nolookup
  376.  
  377.  sub.w #512,PLR2_AIMSPD
  378.  sub.w #4,d0
  379.  cmp.w #-80,d0
  380.  bgt.s .nolookup
  381.  move.w #-512*20,PLR2_AIMSPD
  382.  move.w #-80,d0
  383. .nolookup:
  384.  moveq #0,d7
  385.  move.b look_down_key,d7
  386.  tst.b (a5,d7.w)
  387.  beq.s .nolookdown
  388.  add.w #512,PLR2_AIMSPD
  389.  add.w #4,d0
  390.  cmp.w #80,d0
  391.  blt.s .nolookdown
  392.  move.w #512*20,PLR2_AIMSPD
  393.  move.w #80,d0
  394. .nolookdown:
  395.  
  396.  
  397.  move.w d0,STOPOFFSET
  398.  neg.w d0
  399.  add.w TOTHEMIDDLE,d0
  400.  move.w d0,SMIDDLEY
  401.  asr.w #1,d0
  402.  muls #104*4,d0
  403.  move.l d0,SBIGMIDDLEY
  404.  
  405.  move.w PLR2s_angpos,d0
  406.  move.w PLR2s_angspd,d3
  407.  move.w #35,d1
  408.  move.w #2,d2
  409.  moveq #0,d7
  410.  move.b run_key,d7
  411.  tst.b (a5,d7.w)
  412.  beq.s .nofaster
  413.  move.w #60,d1
  414.  move.w #3,d2
  415. .nofaster:
  416.  tst.b PLR2_Ducked
  417.  beq.s .nohalve
  418.  asr.w #1,d2
  419. .nohalve
  420.  
  421.  moveq #0,d4 
  422.  
  423.  tst.b SLOWDOWN
  424.  beq.s .nofric
  425.  move.w d3,d5
  426.  add.w d5,d5
  427.  add.w d5,d3
  428.  asr.w #2,d3
  429.  bge.s .nneg
  430.  addq #1,d3
  431. .nneg:
  432. .nofric:
  433.  
  434.  move.b turn_left_key,templeftkey
  435.  move.b turn_right_key,temprightkey
  436.  move.b sidestep_left_key,tempslkey
  437.  move.b sidestep_right_key,tempsrkey
  438.  
  439.  move.b force_sidestep_key,d7
  440.  tst.b (a5,d7.w)
  441.  beq .noalwayssidestep
  442.  
  443.  move.b templeftkey,tempslkey
  444.  move.b temprightkey,tempsrkey
  445.  move.b #255,templeftkey
  446.  move.b #255,temprightkey
  447.  
  448. .noalwayssidestep:
  449.  
  450.  tst.b SLOWDOWN
  451.  beq.s noturnposs2
  452.  
  453.  
  454.  move.b templeftkey,d7
  455.  tst.b (a5,d7.w)
  456.  beq.s .noleftturn
  457.  sub.w TURNSPD,d3
  458. .noleftturn
  459.  move.l #KeyMap,a5
  460.  move.b temprightkey,d7
  461.  tst.b (a5,d7.w)
  462.  beq.s .norightturn
  463.  add.w TURNSPD,d3
  464. .norightturn
  465.  
  466.  cmp.w d1,d3
  467.  ble.s .okrspd
  468.  move.w d1,d3
  469. .okrspd:
  470.  neg.w d1
  471.  cmp.w d1,d3
  472.  bge.s .oklspd
  473.  move.w d1,d3
  474. .oklspd:
  475.  
  476. noturnposs2:
  477.  
  478.  add.w d3,d0
  479.  add.w d3,d0
  480.  move.w d3,PLR2s_angspd
  481.  
  482.  move.b tempslkey,d7
  483.  tst.b (a5,d7.w)
  484.  beq.s .noleftslide
  485.  add.w d2,d4
  486.  add.w d2,d4
  487.  asr.w #1,d4
  488. .noleftslide
  489.  move.l #KeyMap,a5
  490.  move.b tempsrkey,d7
  491.  tst.b (a5,d7.w)
  492.  beq.s .norightslide
  493.  add.w d2,d4
  494.  add.w d2,d4
  495.  asr.w #1,d4
  496.  neg.w d4
  497. .norightslide
  498.   
  499. noslide2:
  500.   
  501.  and.w #8191,d0
  502.  move.w d0,PLR2s_angpos
  503.  
  504.  move.w (a0,d0.w),PLR2s_sinval
  505.  adda.w #2048,a0
  506.  move.w (a0,d0.w),PLR2s_cosval
  507.  
  508.  move.l PLR2s_xspdval,d6
  509.  move.l PLR2s_zspdval,d7
  510.  
  511.  tst.b SLOWDOWN
  512.  beq.s .nofriction
  513.  
  514.  neg.l d6
  515.  ble.s .nobug1
  516.  asr.l #3,d6
  517.  add.l #1,d6
  518.  bra.s .bug1
  519. .nobug1
  520.  asr.l #3,d6
  521. .bug1:
  522.  
  523.  neg.l d7
  524.  ble.s .nobug2
  525.  asr.l #3,d7
  526.  add.l #1,d7
  527.  bra.s .bug2
  528. .nobug2
  529.  asr.l #3,d7
  530. .bug2: 
  531.  
  532. .nofriction
  533.  
  534.  moveq #0,d3
  535.  
  536.  moveq #0,d5
  537.  move.b forward_key,d5
  538.  tst.b (a5,d5.w)
  539.  beq.s .noforward
  540.  neg.w d2
  541.  move.w d2,d3
  542.  
  543. .noforward:
  544.  move.b backward_key,d5
  545.  tst.b (a5,d5.w)
  546.  beq.s .nobackward
  547.  move.w d2,d3
  548. .nobackward:
  549.  
  550.  move.w d3,d2
  551.  asl.w #6,d2
  552.  move.w d2,d1
  553. ; add.w d2,d1
  554. ; add.w d2,d1
  555.  move.w d1,ADDTOBOBBLE
  556.  
  557.  move.w PLR2s_sinval,d1
  558.  muls d3,d1
  559.  move.w PLR2s_cosval,d2
  560.  muls d3,d2
  561.  
  562.  sub.l d1,d6
  563.  sub.l d2,d7
  564.  move.w PLR2s_sinval,d1
  565.  muls d4,d1
  566.  move.w PLR2s_cosval,d2
  567.  muls d4,d2
  568.  sub.l d2,d6
  569.  add.l d1,d7
  570.  
  571.  tst.b SLOWDOWN
  572.  beq.s .nocontrolposs
  573.  add.l d6,PLR2s_xspdval
  574.  add.l d7,PLR2s_zspdval
  575. .nocontrolposs:
  576.  move.l PLR2s_xspdval,d6
  577.  move.l PLR2s_zspdval,d7
  578.  add.l d6,PLR2s_xoff
  579.  add.l d7,PLR2s_zoff
  580.  
  581.  move.b fire_key,d5
  582.  tst.b PLR2_fire
  583.  beq.s .firenotpressed
  584. ; fire was pressed last time.
  585.  tst.b (a5,d5.w)
  586.  beq.s .firenownotpressed
  587. ; fire is still pressed this time.
  588.  st PLR2_fire
  589.  bra .doneplr2
  590.  
  591. .firenownotpressed:
  592. ; fire has been released.
  593.  clr.b PLR2_fire
  594.  bra .doneplr2
  595.  
  596. .firenotpressed
  597.  
  598. ; fire was not pressed last frame...
  599.  
  600.  tst.b (a5,d5.w)
  601. ; if it has still not been pressed, go back above
  602.  beq.s .firenownotpressed
  603. ; fire was not pressed last time, and was this time, so has
  604. ; been clicked.
  605.  st PLR2_clicked
  606.  st PLR2_fire
  607.  
  608. .doneplr2:
  609.  
  610.  bsr PLR2_fall
  611.  
  612.  rts
  613.  
  614.  
  615.  
  616.  
  617. PLR2_JoyStick_control:
  618.  
  619.  jsr _ReadJoy2
  620.  bra PLR2_keyboard_control
  621.  
  622. PLR2_clumptime: dc.w 0
  623.  
  624. PLR2clump:
  625.  
  626.  movem.l d0-d7/a0-a6,-(a7)
  627.  move.l PLR2_Roompt,a0
  628.  move.w ToFloorNoise(a0),d0
  629.  
  630.  move.l ToZoneWater(a0),d1
  631.  cmp.l ToZoneFloor(a0),d1
  632.  bge.s THERESNOWATER2
  633.  
  634.  cmp.l PLR2_yoff,d1
  635.  blt.s THERESNOWATER2
  636.  
  637.  move.w #6,d0
  638.  bra.s THERESWATER2
  639.  
  640. THERESNOWATER2:
  641.  
  642.  tst.b PLR2_StoodInTop
  643.  beq.s .okinbot
  644.  move.w ToUpperFloorNoise(a0),d0
  645. .okinbot:
  646.  
  647.  move.l LINKFILE,a0
  648.  add.l #FloorData,a0
  649.  move.w 2(a0,d0.w*4),d0    ; sample number.
  650.  
  651.  subq #1,d0
  652.  blt.s nofootsound2
  653.  
  654. THERESWATER2:
  655.  move.w d0,Samplenum
  656.  move.w #0,Noisex
  657.  move.w #100,Noisez
  658.  move.w #80,Noisevol
  659.  move.b #$f9,IDNUM
  660.  clr.b notifplaying
  661.  jsr MakeSomeNoise
  662.  
  663. nofootsound2:
  664.  movem.l (a7)+,d0-d7/a0-a6
  665.  
  666.  rts
  667.